package cz.cizek.tutorials.designpatterns.immutableobject.wrong_non_immutable;

/**
 * @author jcizek
 */
public class NonImmutableFraction2 extends NonImmutableFraction {

    public NonImmutableFraction2(int numerator, int denominator) {
        super(numerator, denominator);
    }

    @Override
    public boolean equals(Object o) {
        if (o instanceof NonImmutableFraction) {
            NonImmutableFraction nonImmutableFraction = (NonImmutableFraction) o;
            return (getNumerator() == nonImmutableFraction.getNumerator())
                    && (getDenominator() == nonImmutableFraction.getDenominator());
        }
        return false;
    }

    @Override
    public int hashCode() {
        return (717 + getNumerator()) * 37 + getDenominator();
    }
}
